package homework;

public class Championships {
    public static void main(String[] args) {
        Sporter s1 = new Sporter("兔子",100,10000);
        Sporter s2 = new Sporter("乌龟",1000,1000);

        s1.start();
        s2.start();

        try {
            s1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        try {
            s2.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //宣布结果
        if(s1.getDistance() > s2.getDistance()){
            System.out.println("兔子赢");
        }else if(s1.getDistance() <s2.getDistance()){
            System.out.println("乌龟赢");
        }else{
            //距离一样
            //System.out.println("平局");
            //如果要再严格一点
            if(s1.getTime() < s2.getTime()){
                System.out.println("兔子赢");
            }else if(s1.getTime() > s2.getTime()){
                System.out.println("乌龟赢");
            }else{
                System.out.println("平局");
            }
        }
    }
}
